package com.baturu.vin.dfpv.dal.dao;

import com.baturu.vin.dfpv.dto.DfpvPartsInfoDTO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Set;

/**
 * @Author: chenjiahao
 * @Time: 2018/8/30
 */
public interface DfpvPartsDAO {
    @Select({"<script>",
            "SELECT  t.cid, t.enSparepName, t.sparepName, t.entryTime, t.epcCount, t.epcRemark, t.grade picOn, t.materialExpend, t.sparepNo partsCode, t.partId, t.series, t.vin,",
            "t1.description groupDes, t1.groupName, t1.groupCode, t1.enGroupName ,t1.sid",
            "FROM dfpv_parts_new t",
            "INNER JOIN dfpv_childgroups t1 ON t.cid = t1.id",
            "WHERE t.series = #{series}",
            "AND t.sparepNo in ",
            "<foreach item = 'item' index = 'index' collection='partsCode' open = '(' separator = ',' close = ')'>",
            "#{item}",
            "</foreach>",
            "</script>"
    })
    List<DfpvPartsInfoDTO> queryPartsBySeries(@Param("series") String series,@Param("partsCode")Set<String> partsCodeSet);
}
